<template>
    <div id="parts">
        <div class="operation">
            <el-button v-if="menuId==='4566'" @click="assignment" class="slot-btn-top" type="primary" size="small">
                发放任务
            </el-button>
             <!-- 查询 -->
            <el-popover placement="bottom-start" width="1000" style="box-shadow: 0 0 8px rgba(0,0,0,.5);" trigger="click">
                <el-form :inline="true" :model="search">
                    <el-form-item label="新机器条码" >
                        <el-input v-model="search.code"></el-input>
                    </el-form-item>
                    <el-form-item label="机器成品名称" >
                        <el-autocomplete  class="inputSuffix"  v-model="search.name" :fetch-suggestions="searchAsyncSupplier" placeholder="请输入供应商名称" @select="changeSupplier"></el-autocomplete>
                    </el-form-item>
                    <el-button type="primary" @click="searchBtn" icon="el-icon-search">查询</el-button>
                </el-form>
                <el-button slot="reference" type="primary">查询</el-button>
            </el-popover>
        </div>
         <el-table :data="dataList" stripe border
                  class="table-index" :height="tableHeight" style="width: 100%;" :header-cell-style="getRowClass">
            <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
            <el-table-column prop="taskcode" label="新机器条码" sortable min-width="160"></el-table-column>
            <el-table-column prop="resourcenameName" label="机器成品名称" sortable min-width="160"></el-table-column>
            <el-table-column prop="macTypeName" label="机型" sortable min-width="160"></el-table-column>
            <el-table-column prop="businesstype" label="总装业务类型" sortable min-width="130"></el-table-column>
            <el-table-column prop="taskperformpersonName" label="任务负责人" sortable min-width="110"></el-table-column>
            <el-table-column prop="taskstartorendtime" label="计划完成时间" sortable min-width="160"></el-table-column>
            <el-table-column prop="taskstartaddtime" label="任务接收创建时间" sortable min-width="160"></el-table-column>
            <el-table-column prop="taskbegintime" label="开始启动时间" sortable min-width="160"></el-table-column>
            <el-table-column prop="taskendtime" label="机器组装结束时间" sortable min-width="160"></el-table-column>
            <el-table-column prop="actualcompletenums" label="出库时间" sortable min-width="160"></el-table-column>
            <el-table-column fixed="right" label="操作" sortable align="center" width="75">
                <template slot-scope="scope">
                    <el-button @click="updateList(scope.row)" type="text" size="small">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
                       :current-page="pagination.currentPage" :page-sizes="[5,10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize"
                       layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
          <!-- 弹框1 -->
        <el-dialog :title="dialog.title" width="800px" center :visible.sync="dialog.isShow" :close-on-click-modal="false" v-dialogDrag>
            <div :style="{height:'400px',overflowY: 'auto'}">
                <el-form class="demo-form-inline" :model="assignmentForm" :rules="assignmentFormRules" label-position="right" label-width="140px" :inline="true" ref="assignmentFormRef">
                    <el-form-item label="总装类型" prop="typeName">
                        <el-autocomplete class="inline-input" v-model="assignmentForm.typeName" :fetch-suggestions="querySearch" placeholder="请输入总装类型" @select="handleSelect"></el-autocomplete>
                    </el-form-item>
                    <el-form-item label="批号" prop="batchnums">
                       <el-input v-model="assignmentForm.batchnums" ></el-input>
                    </el-form-item>
                    <el-form-item label="完成日期" prop="taskstartorendtime">
                         <el-date-picker v-model="assignmentForm.taskstartorendtime" format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间" style="width: 200px;"></el-date-picker>
                    </el-form-item>
                </el-form>
            </div>
            <div slot="footer" class="dialog-footer" style="text-align: center;">
                <el-button @click="assignmentSubmit" type="primary">确 定</el-button>
            </div>
        </el-dialog>
        <!-- 弹框2 -->
         <el-dialog :title="dialogTitle" width="90%" top="30px" :visible.sync="isDialog" :close-on-click-modal="false">
            <el-tabs v-model="activeName" @tab-click="handleClick" style="padding-bottom: 15px;">
                <el-tab-pane label="任务信息" name="1" class="dialog1" :style="dialogHeightPane">
                    <h3 class="dialog-plate-title"><span>基本信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right"
                             label-width="180px">
                        <el-form-item label="新机器条码">
                            <el-input v-model="dialogList.taskcode" :disabled="!dialogListDisabled.taskcode"></el-input>
                        </el-form-item>
                        <el-form-item label="生产批号">
                            <el-input v-model="dialogList.batchnums"
                                      :disabled="!dialogListDisabled.batchnums"></el-input>
                        </el-form-item>
                        <el-form-item label="总装名称">
                            <el-input v-model="dialogList.resourcenameName"
                                      :disabled="!dialogListDisabled.resourcenameName"></el-input>
                        </el-form-item>
                         <el-form-item label="机型">
                            <el-input v-model="dialogList.macTypeName" disabled></el-input>
                        </el-form-item>

                        <el-form-item label="产品型号">
                            <el-input v-model="dialogList.typenums" :disabled="!dialogListDisabled.typenums"></el-input>
                        </el-form-item>
                        <el-form-item label="总装业务类型">
                            <el-input v-model="dialogList.businesstype"
                                      :disabled="!dialogListDisabled.businesstype"></el-input>
                        </el-form-item>
                        <el-form-item label="任务创建人">
                            <el-input v-model="dialogList.taskreleasepersonName"
                                      :disabled="!dialogListDisabled.taskreleasepersonName"></el-input>
                        </el-form-item>
                        <el-form-item label="任务创建时间">
                            <el-date-picker v-model="dialogList.taskreleaseaddtime"
                                            :disabled="!dialogListDisabled.taskreleaseaddtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="任务负责人">
                            <el-select v-model="dialogList.taskperformperson"
                                       :disabled="!dialogListDisabled.taskperformperson">
                                <el-option v-for="item in materialManagers" :key="item.id" :label="item.name"
                                           :value="item.id"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="计划完成时间">
                            <el-date-picker v-model="dialogList.taskstartorendtime"
                                            :disabled="!dialogListDisabled.taskstartorendtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="计划创建类型">
                            <el-select v-model="dialogList.tasktype" :disabled="!dialogListDisabled.tasktype">
                                <el-option label="计划任务" :value="1"></el-option>
                                <el-option label="临时任务" :value="2"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-form>

                    <h3 class="dialog-plate-title"><span>待办信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right"
                             label-width="180px">
                        <el-form-item label="任务是否接收">
                            <el-select v-model="dialogList.istaskstart" :disabled="!dialogListDisabled.istaskstart">
                                <el-option label="否" value="0"></el-option>
                                <el-option label="是" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="接收创建时间">
                            <el-date-picker v-model="dialogList.taskstartaddtime"
                                            :disabled="!dialogListDisabled.taskstartaddtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                    </el-form>

                    <h3 class="dialog-plate-title"><span>进行中信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right"
                             label-width="180px">
                        <el-form-item label="任务是否开始">
                            <el-select v-model="dialogList.istaskbegin" :disabled="!dialogListDisabled.istaskbegin">
                                <el-option label="否" value="0"></el-option>
                                <el-option label="是" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="任务开始时间">
                            <el-date-picker v-model="dialogList.taskbegintime"
                                            :disabled="!dialogListDisabled.taskbegintime" format="yyyy-MM-dd HH:mm:ss"
                                            type="datetime" placeholder="选择日期时间" style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="启动创建时间">
                            <el-date-picker v-model="dialogList.taskbeginaddtime"
                                            :disabled="!dialogListDisabled.taskbeginaddtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="任务是否结束">
                            <el-select v-model="dialogList.istaskend" :disabled="!dialogListDisabled.istaskend">
                                <el-option label="否" value="0"></el-option>
                                <el-option label="是" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="机器组装结束时间">
                            <el-date-picker v-model="dialogList.taskendtime" :disabled="!dialogListDisabled.taskendtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="结束创建时间">
                            <el-date-picker v-model="dialogList.taskendaddtime"
                                            :disabled="!dialogListDisabled.taskendaddtime" format="yyyy-MM-dd HH:mm:ss"
                                            type="datetime" placeholder="选择日期时间" style="width: 200px;"></el-date-picker>
                        </el-form-item>
                    </el-form>

                    <h3 class="dialog-plate-title"><span>复核信息</span></h3>
                    <el-form :inline="true" class="demo-form-inline" v-model="dialogList" label-position="right"
                             label-width="180px">
                        <el-form-item label="任务是否复核">
                            <el-select v-model="dialogList.isreviewtask" :disabled="!dialogListDisabled.isreviewtask">
                                <el-option label="否" value="0"></el-option>
                                <el-option label="是" value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="复核执行人">
                            <el-input v-model="dialogList.reviewpersonName"
                                      :disabled="!dialogListDisabled.reviewpersonName"></el-input>
                        </el-form-item>
                        <el-form-item label="复核结果">
                            <el-select v-model="dialogList.reviewresult" :disabled="!dialogListDisabled.reviewresult">
                                <el-option label="【空】" value="-1"></el-option>
                                <el-option label="正常" value="1"></el-option>
                                <el-option label="异常" value="0"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="复核时间">
                            <el-date-picker v-model="dialogList.reviewtime" :disabled="!dialogListDisabled.reviewtime"
                                            format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择日期时间"
                                            style="width: 200px;"></el-date-picker>
                        </el-form-item>
                        <el-form-item label="复核创建时间">
                            <el-date-picker v-model="dialogList.reviewaddtime"
                                            :disabled="!dialogListDisabled.reviewaddtime" format="yyyy-MM-dd HH:mm:ss"
                                            type="datetime" placeholder="选择日期时间" style="width: 200px;"></el-date-picker>
                        </el-form-item>
                    </el-form>
                    <div style="text-align: right">
                        <el-button @click="submitList" type="primary">确 定</el-button>
                    </div>
                </el-tab-pane>
                <el-tab-pane v-if="dialogType !== '1'" label="物料&部件" name="2" :style="dialogHeightPane">

                    <h3 class="dialog-plate-title"><span>物料</span></h3>
                     <el-button  @click="pickingAll()" class="slot-btn-top" type="primary" size="small">一键领取</el-button>
                    <el-table :data="zzMaterie.list" stripe border class="table-index"  style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column prop="nameName" label="物料名称" sortable min-width="170"></el-table-column>
                        <el-table-column prop="code" label="物料条码" sortable min-width="170"></el-table-column>
                         <el-table-column prop="type" label="物料型号" sortable min-width="170"></el-table-column>
                        <el-table-column prop="num" label="数量" sortable min-width="100"></el-table-column>
                        <el-table-column prop="isAssembly" label="领料" sortable width="80">
                            <template slot-scope="scope">
                                <span :class="scope.row.isAssembly===1?'el-icon-circle-check cl-success':'el-icon-circle-close cl-danger'" class="icon-circle"></span>
                            </template>
                        </el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="75">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('materiel',scope.row)" type="text" size="small">查看物料</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <h3 class="dialog-plate-title"><span>部件</span></h3>
                    <el-table :data="zzParts.list" stripe border class="table-index"  style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column prop="nameName" label="物料名称" sortable min-width="170"></el-table-column>
                        <el-table-column prop="code" label="物料条码" sortable min-width="170"></el-table-column>
                        <el-table-column prop="num" label="数量" sortable min-width="100"></el-table-column>
                        <el-table-column prop="isAssembly" label="领料"  sortable  width="80">
                             <template slot-scope="scope">
                                <span :class="scope.row.isAssembly===1?'el-icon-circle-check cl-success':'el-icon-circle-close cl-danger'" class="icon-circle"></span>
                            </template>
                        </el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="75">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('parts',scope.row)" type="text" size="small">查看物料</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane v-if="dialogType !== '1'" label="装配过程" name="3" :style="dialogHeightPane">
                    <h3 class="dialog-plate-title"><span>装配过程过程信息录入</span></h3>
                     <check-form  :data="assembly.list" @submitHanld="submitHanld" @changeDisable="changeDisable" :isDisabled="assembly.disabled"></check-form>
                </el-tab-pane>
                <el-tab-pane v-if="dialogType !== '1'"  label="输出结果" name="4" :style="dialogHeightPane">
                    <el-button  @click="addResult()" class="slot-btn-top" type="primary" size="small">新增输出结果</el-button>
                     <el-table :data="result.list" stripe border class="table-index" :height="dialogTableHeight" style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column prop="name" label="名称"    sortable min-width="170"></el-table-column>
                        <el-table-column prop="jqzzResults.length" label="检查项数量"    sortable min-width="170"></el-table-column>
                        <el-table-column prop="createTime" label="创建时间"   sortable min-width="100"></el-table-column>
                        <el-table-column prop="creator" label="创建人"   sortable min-width="100"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="160">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('update',scope.row)" type="text" size="small">编辑</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane  label="技术标准" name="5" :style="dialogHeightPane">
                    <el-table  :data="technicalStandard" tooltip-effect="dark"  style="width: 100%" >
                        <el-table-column prop="fileName" label="文件名称"> </el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="160">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('watch',scope.row)" type="text" size="small">查看</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane  label="图纸" name="6" :style="dialogHeightPane">
                    <el-table  :data="drawingList" tooltip-effect="dark"  style="width: 100%" >
                        <el-table-column prop="cidName" label="图纸名称"> </el-table-column>
                         <el-table-column fixed="right" label="操作" sortable align="center" width="160">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('watch',scope.row)" type="text" size="small">查看</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
                <el-tab-pane  label="SOP" name="7" :style="dialogHeightPane">
                    <el-table  :data="sopList" tooltip-effect="dark"  style="width: 100%" >
                        <el-table-column prop="fileName" label="SOP名称"> </el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="160">
                            <template slot-scope="scope">
                                <el-button @click="showDialog1('watch',scope.row)" type="text" size="small">查看</el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                </el-tab-pane>
            </el-tabs>
        </el-dialog>
        <el-dialog :title="dialog1.title" width="90%" top="30px" :visible.sync="dialog1.isShow" :close-on-click-modal="false" v-dialogDrag>
            <div class="" :style="dialogHeightPane" v-if="activeName==2&&dialog1.title=='物料入库'">
                <el-button  @click="showDialog2('add','','materie')" class="slot-btn-top" type="primary" size="small">领料</el-button>
                <el-table :data="zzMaterie.selectList" stripe border class="table-index"  style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column fixed prop="nameName" label="物料名称" sortable min-width="100"></el-table-column>
                        <el-table-column prop="type" label="产品型号"  min-width="100"></el-table-column>
                        <el-table-column prop="code" label="条码"  min-width="80"></el-table-column>
                        <el-table-column prop="batch" label="批号"  min-width="80"></el-table-column>
                        <el-table-column prop="num" label="数量"  min-width="50"></el-table-column>
                        <el-table-column prop="creatorName" label="领料人"  min-width="60"></el-table-column>
                        <el-table-column prop="state" label="物料状态" min-width="60">
                             <template slot-scope="scope">
                               <el-tag type="success" v-if="scope.row.state==1">合格</el-tag>
                               <el-tag type="danger" v-if="scope.row.state==0">不合格</el-tag>
                               <!-- <el-tag type="info" v-if="scope.row.state==-1">报废</el-tag> -->
                            </template>
                        </el-table-column>
                        <el-table-column prop="createTime" label="领料时间" sortable min-width="100"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="120">
                            <template slot-scope="scope">
                                <el-button @click="showDialog2('insert',scope.row,'materie')" type="text" size="small" v-if="scope.row.isCheck==1">检验</el-button>
                                <el-button @click="deleteSelectMaterie(scope.row,'materie')" type="text" size="small">删除</el-button>
                                <el-button @click="printCode(scope.row.code)" type="text" size="small" v-if="scope.row.code">打印条码</el-button>
                                <el-button @click="changStatus(scope.row)" type="text" size="small" v-if="scope.row.isCheck!==1">标记为{{scope.row.state==1?'不合格':'合格'}}</el-button>
                            </template>
                        </el-table-column>
                </el-table>
            </div>
            <div class="" :style="dialogHeightPane" v-if="activeName==2&&dialog1.title=='部件入库'">
                <el-button  @click="showDialog2('add','','parts')" class="slot-btn-top" type="primary" size="small">领料</el-button>
                <el-table :data="zzParts.selectList" stripe border class="table-index"  style="width: 100%;" :header-cell-style="getRowClass">
                        <el-table-column fixed type="index" label="*" sortable min-width="40"></el-table-column>
                        <el-table-column fixed prop="nameName" label="物料名称" sortable min-width="100"></el-table-column>
                        <el-table-column prop="type" label="产品型号"  min-width="100"></el-table-column>
                        <el-table-column prop="code" label="条码"  min-width="80"></el-table-column>
                        <el-table-column prop="batch" label="批号"  min-width="80"></el-table-column>
                        <el-table-column prop="num" label="数量"  min-width="50"></el-table-column>
                        <el-table-column prop="creatorName" label="领料人"  min-width="60"></el-table-column>
                        <el-table-column prop="state" label="物料状态" min-width="60">
                             <template slot-scope="scope">
                               <el-tag type="success" v-if="scope.row.state==1">合格</el-tag>
                               <el-tag type="danger" v-if="scope.row.state==0">不合格</el-tag>
                               <el-tag type="info" v-if="scope.row.state==-1">报废</el-tag>
                            </template>
                        </el-table-column>
                        <el-table-column prop="createTime" label="领料时间" sortable min-width="100"></el-table-column>
                        <el-table-column fixed="right" label="操作" sortable align="center" width="120">
                            <template slot-scope="scope">
                                <el-button @click="showDialog2('insert',scope.row,'parts')" type="text" size="small"  v-if="scope.row.isCheck==1">检验</el-button>
                                <el-button @click="deleteSelectMaterie(scope.row,'parts')" type="text" size="small">删除</el-button>
                                 <el-button @click="printCode(scope.row.code)" type="text" size="small" v-if="scope.row.code">打印条码</el-button>
                            </template>
                        </el-table-column>
                </el-table>
            </div>
             <div class="" :style="dialogHeightPane" v-if="activeName==3">

            </div>
             <div class="" :style="dialogHeightPane" v-if="activeName==4">
                 <check-form  :data="result.dialogForm.list" @submitHanld="submitHanld"></check-form>
            </div>
            <div v-if="activeName==5||activeName==7">
                <div v-html="dialog1.content"></div>
            </div>
            <div v-if="activeName==6">
                <el-input v-model.number="drawingPdf.instructionsPageApply" type="number" style="width: 100px;" min="1"
                    :max="drawingPdf.instructionsNumPagesApply"></el-input>
                <span>/{{drawingPdf.instructionsNumPagesApply}}</span>
                <el-button @click="drawingPdf.instructionsRotateApply += 90">&#x27F3;</el-button>
                <pdf ref="applyInstructionsPdf"
                        style="border: 1px solid red;"
                        :src="drawingPdf.src"
                        :page="drawingPdf.instructionsPageApply"
                        :rotate="drawingPdf.instructionsRotateApply"
                        @progress="drawingPdf.instructionsLoadedRatioApply = $event"
                        @num-pages="drawingPdf.instructionsNumPagesApply = $event"
                        @link-clicked="drawingPdf.instructionsPageApply = $event">
                </pdf>
            </div>
        </el-dialog>
        <el-dialog :title="dialog2.title" width="400" top="30px" :visible.sync="dialog2.isShow" :close-on-click-modal="false" v-dialogDrag>
            <div class="" :style="dialogHeightPane" v-if="dialog2.title==='物料领取'">
                  <el-table ref="multipleTable" highlight-current-row @current-change="handleCurrentChange1" :data="dialog2.table" tooltip-effect="dark" style="width: 100%">
                    <el-table-column label="选择" width="50" align="center">
                        <template slot-scope="scope">
                            <el-radio class="radio"  v-model="dialog2.dialogForm.name"  :label="scope.row.tid">&nbsp;</el-radio>
                        </template>
                    </el-table-column>
                    <el-table-column label="物料名称" prop="cgMaterial.name"></el-table-column>
                    <el-table-column label="令号" prop="taskcode"></el-table-column>
                    <el-table-column label="物料型号" prop="cgMaterial.type"></el-table-column>
                    <el-table-column label="物料库存" prop="remainingnums"></el-table-column>
                </el-table>
                <el-form :inline="true" :model="dialog2.dialogForm" class="demo-form-inline" style='margin-top:24px;' v-if="dialog2.title=='物料领取'">
                    <el-form-item label="领料数量">
                        <el-input v-model="dialog2.dialogForm.num" placeholder="请输入领料数量"></el-input>
                    </el-form-item>
                </el-form>
                <div style="text-align: center;margin-top:24px;">
                    <el-button  type="primary" @click="addMateriel">确 定</el-button>
                </div>
            </div>
            <div v-else-if="dialog2.title==='部件领取'">
                <el-form :inline="true" v-model="dialog2.dialogForm" class="demo-form-inline" style='margin-top:24px;'>
                    <el-form-item label="部件条码">
                        <el-input v-model="dialog2.dialogForm.code" placeholder="请输入部件条码" autofocus  @keyup.enter.native="doLogin">
                             <el-button slot="append" @click="doLogin">查询</el-button>
                        </el-input>
                    </el-form-item>
                </el-form>
                <el-table ref="multipleTable" highlight-current-row @current-change="handleCurrentChange1" :data="dialog2.dialogForm.list" tooltip-effect="dark" style="width: 100%" v-if="dialog2.dialogForm.list.length>0">
                    <el-table-column label="部件名称" prop="resourcenameName"></el-table-column>
                    <el-table-column label="条码" prop="taskcode"></el-table-column>
                </el-table>
                <div style="text-align: center;margin-top:24px;">
                    <el-button  type="primary" @click="addMateriel">确 定</el-button>
                </div>
            </div>
            <div class="" :style="dialogHeightPane" v-else>
               <check-form :data="dialog2.checkForm.list" @submitHanld="submitHanld"></check-form>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import pdf from 'vue-pdf';
import api from '@/axios/api.js'
import scybHttp from '@/axios/scybHttp.js';
import YCamera from '@/components/common/camera.vue'
import {getLodop} from 'static/js/LodopFuncs'
import checkForm from './components/checkForm.vue'
export default {
    name: "",
    components:{
        YCamera,
        pdf,
        checkForm
    },
    data() {
        let menuId = sessionStorage.getItem('menuId');
        let tableHeight = menuId === '4566' ? (document.documentElement.clientHeight - 170) : (document.documentElement.clientHeight - 140);
        let validateBatch=(rule, value, callback) => {
            let reg = /^\d{6}$/
            if(!reg.test(value)){
                callback(new Error('请输入六位数字的批号'));
            }else{
                callback()
            }
         }
        return {
            /** pdf*/
            drawingPdf:{
                src:'',
                instructionsPageApply:1,
                instructionsNumPagesApply: 0,
                instructionsRotateApply: 0,
            },
            search:{
                  code:'',
                  name:'',
                  nameId:''
                },
            tableDialogHeightTabPane:{/**dialog style */
                height: (document.documentElement.clientHeight - 300) + 'px',
                overflowY: 'auto'
            },
            dialogTableHeight: document.documentElement.clientHeight - 260,
            menuId,
            allType:[],/**总装类型 */
            materialManagers:[],/**负责人列表 */
            dialog:{
                title:'',
                isShow:false
            },
            dialog1:{
                title:'',
                isShow:false,
                content:''
            },
            dialog2:{
                title:'',
                isShow:false,
                table:[],
                dialogForm:{
                    name: '',
                    num: 1,
                    pid: ''
                },
                checkForm:{
                    list:[],
                    id:''
                }
            },
            tableHeight: tableHeight,
             dialogHeightPane: {
                height: (document.documentElement.clientHeight - 180) + 'px',
                overflowY: 'auto'
            },
            activeName: '1',
            assignmentForm:{},/**发放任务form */
            assignmentFormRules:{
                typeName:[{ required: true, message: '请选择总装类型', trigger: 'blur' }],
                taskstartorendtime:[{ required: true, message: '请选择完成日期', trigger: 'blur' }],
                batchnums:[
                    { required: true, message: '请输入六位数字的批号', trigger: 'blur' },
                    {validator:validateBatch, trigger: ['change','blur' ]}
                ],
            },
            allDataList:[],/**所有任务列表 */
            dataList:[],/**任务列表 */
            loading:false,
            pagination:{
                currentPage:1,
                pageSize:10,
                total:0
            },
            //基本信息
            isDialog: false,
            dialogTitle: '',
            dialogType: '',
            dialogList: {
                    actualcompletenums: "",
                    batchnums: "",
                    businesstype: "",
                    isoutstorage: "",
                    isreviewtask: "",
                    istaskbegin: "",
                    istaskend: "",
                    istaskstart: "",
                    resourcename: "",
                    resourcenameName: "",
                    reviewaddtime: "",
                    reviewperson: "",
                    reviewpersonName: "",
                    reviewresult: "",
                    reviewtime: "",
                    taskbeginaddtime: "",
                    taskbegintime: "",
                    taskcode: "",
                    taskendaddtime: "",
                    taskendtime: "",
                    taskfinishstate: "",
                    tasknums: "",
                    taskperformperson: "",
                    taskperformpersonName: "",
                    taskreleaseaddtime: "",
                    taskreleaseperson: "",
                    taskreleasepersonName: "",
                    taskstartaddtime: "",
                    taskstartorendtime: "",
                    taskstate: "",
                    tasksummingtype: "",
                    tasktype: "",
                    tid: "",
                    typenums: "",
                },
                dialogListDisabled: {
                    taskcode: true,
                    batchnums: true,
                    resourcename: true,
                    resourcenameName: false,
                    typenums: true,
                    businesstype: true,
                    taskreleaseperson: true,
                    taskreleasepersonName: true,
                    taskreleaseaddtime: true,
                    taskperformperson: true,
                    taskperformpersonName: true,
                    taskstartorendtime: true,
                    tasktype: true,
                    istaskstart: true,
                    taskstartaddtime: true,
                    istaskbegin: true,
                    taskbegintime: true,
                    taskbeginaddtime: true,
                    istaskend: true,
                    taskendtime: true,
                    taskendaddtime: true,
                    isreviewtask: true,
                    reviewperson: true,
                    reviewpersonName: true,
                    reviewresult: true,
                    reviewtime: true,
                    reviewaddtime: true,
                    tasknums: true,
                    actualcompletenums: true,
                    isoutstorage: true,
                    taskfinishstate: true,
                    taskstate: true,
                    tasksummingtype: true,
                    tid: true,
                },
                technicalStandard:[],/**技术标准 */
                drawingList:[],/**图纸列表 */
                sopList:[],/**sop列表 */
                zzMaterie:{/**总装物料 */
                    list:[],
                    dialogForm:{},
                    selectList:[],
                    storeList:[],
                    checkForm:{},
                    checkId:''
                },
                zzParts:{/**总装部件 */
                    list:[],
                    dialogForm:{},
                    selectList:[],
                    storeList:[],
                    checkForm:{},
                    checkId:'',
                    PartsName:''
                },
                assembly:{/**装配记录 */
                    list:[],
                    dialogForm:{},
                    disabled:true,
                    submitLoading:false
                },
                result:{/**结果记录 */
                    list:[],
                    dialogForm:{
                        list:[]
                    }
                },
                allZzProcedureList:[]/**总装工序所有列表 */

        }
    },
    created(){
        let self = this;
        scybHttp.bzAllJy().then(res=>{
            res.content.forEach(el=>{
                el.value=el.name
            })
            self.allType=res.content
        })
        scybHttp.allZzProcedureList().then(res=>{
             res.content.forEach(el=>{
                el.value=el.name
            })
            self.allZzProcedureList=res.content
        })
        self.getTableList();
        self.getManagersList();
    },
    methods:{
        assemblyFormatter(row, column, cellValue, index){
            return cellValue == 1 ? '符合' : (cellValue == 0 ? '不符合' : '')
        },
        resultFormatter(row, column, cellValue, index){
            return cellValue == 1 ? '合格' : (cellValue == 0 ? '不合格' : '')
        },
        getTableList(){/**获取任务列表 */
            let self = this;
            self.loading=true;
            let postData={
                code:self.search.code,
                name:self.search.name===''?null:self.search.nameId,
                currentPage:self.pagination.currentPage,
                pageSize:self.pagination.pageSize
            }
            switch(self.menuId){
                case '4566':
                    postData.taskState=0;
                    postData.taskFinishState=0;
                    postData.isReviewTask=0;
                    break;
                case '4567':
                    postData.taskState=1;
                    postData.taskFinishState=0;
                    postData.isReviewTask=0;
                    break;
                case '4568':
                    postData.taskState=1;
                    postData.taskFinishState=1;
                    postData.isReviewTask=0;
                    break;
                case '4569':
                    postData.taskState=1;
                    postData.taskFinishState=1;
                    postData.isReviewTask=1;
                    break;
            }
            api.zzAssignmentList(postData).then(res=>{
                 self.loading=false;
                 self.dataList=res.content.records;
                 self.pagination.total=res.content.total;
            },error=>{
                self.loading=false;
            })
        },
        searchBtn(){
            this.getTableList();
        },
        assignment(){
            let self = this;
            self.dialog.title="发放任务";
            self.dialog.isShow=true;
        },
        querySearch(queryString, cb) {
            let self = this;
            var restaurants = self.allType;
            var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
        // 调用 callback 返回建议列表的数据
             cb(results);
        },
        handleSelect(item) {
           let self = this;
           self.assignmentForm.resourcename=item.id;
        },
        createStateFilter(queryString) {
            return (state) => {
                console.log(state.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1)
                return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) > -1);
            }
        },
        assignmentSubmit(){/**发放任务 */
            let self =this;
            self.$refs.assignmentFormRef.validate((valid)=>{
                if(valid){
                    let postData={
                        resourcename:self.assignmentForm.resourcename,
                        taskstartorendtime: self.timestampToTime1(self.assignmentForm.taskstartorendtime,'yy-mm-dd hh:mm:ss'),
                        batchnums:self.assignmentForm.batchnums
                    }
                    api.addAssignment(postData).then(res=>{
                        self.$message.success(`${self.dialog.title}成功`);
                        self.dialog.isShow=false;
                        self.getTableList();
                    })
                }

            })

        },
         updateList(row) {
                this.isDialog = true;
                this.dialogType = '2';
                this.activeName = '1';
                this.dialogListDisabled = {
                    taskcode: false,
                    batchnums: this.menuId === '4566' ? true : false,
                    resourcename: this.menuId === '4566' ? true : false,
                    resourcenameName: false,
                    typenums: this.menuId === '4566' ? true : false,
                    businesstype: this.menuId === '4566' ? true : false,
                    taskreleaseperson: false,
                    taskreleasepersonName: false,
                    taskreleaseaddtime: false,
                    taskperformperson: this.menuId === '4566' ? true : false,
                    taskperformpersonName: this.menuId === '4566' ? true : false,
                    taskstartorendtime: this.menuId === '4566' ? true : false,
                    tasktype: this.menuId === '4566' ? true : false,
                    istaskstart: this.menuId === '4566' ? true : false,
                    taskstartaddtime: false,
                    istaskbegin: this.menuId === '4567' ? true : false,
                    taskbegintime: this.menuId === '4567' ? true : false,
                    taskbeginaddtime: false,
                    istaskend: this.menuId === '4567' ? true : false,
                    taskendtime: this.menuId === '4567' ? true : false,
                    taskendaddtime: false,
                    isreviewtask: this.menuId === '4568' ? true : false,
                    reviewperson: false,
                    reviewpersonName: false,
                    reviewresult: this.menuId === '4568' ? true : false,
                    reviewtime: this.menuId === '4568' ? true : false,
                    reviewaddtime: false,
                    tasknums: false,
                    actualcompletenums: false,
                    isoutstorage: false,
                    taskfinishstate: false,
                    taskstate: false,
                    tasksummingtype: false,
                    tid: false,
                };
                this.dialogList = row;
                this.dialogList.resourcename = this.dialogList.resourcename?parseInt(this.dialogList.resourcename):'';
                this.dialogList.taskperformperson =this.dialogList.taskperformperson?parseInt(this.dialogList.taskperformperson):'';
            },
            handleClick(tab, event) {
                let self = this;
                switch(tab.name){
                    case '1':
                    break;
                    case '2':
                        self.getZzMaterieList();
                        self.getZzPartsList();
                    break;
                      case '3':
                        self.getAssemblyList();
                    break;
                    case '4':
                        self.getResulteList();
                    break;
                    case '5':
                        self.getTec();
                    break;
                     case '6':
                        self.getDrawingList();
                    break;
                    case '7':
                        self.getSOPList();
                    break;

                }

            },
             getTec(){/**获取技术标准列表 */
                let self=this;
                api.zzTechnicalStandard(self.dialogList.resourcename).then(res=>{
                self.technicalStandard=res.content;
                })
            },
            getDrawingList(){/**获取图纸列表 */
                let self=this;
                scybHttp.zzDrawingList(self.dialogList.resourcename).then(res=>{
                    self.drawingList=res.content;
                })
            },
            getSOPList(){/**获取sop列表 */
                let self=this;
                api.zzSOPList(self.dialogList.resourcename).then(res=>{
                    self.sopList=res.content;
                })
            },
            getManagersList(){/**获取管理者列表 */
                let self = this;
                api.managersList().then(res=>{
                    self.materialManagers=res.content;
                })
            },
            submitList(){
                let self = this;
                let url;
                self.dialogList.taskstartorendtime = self.timestampToTime(self.dialogList.taskstartorendtime);
                self.dialogList.taskbegintime = self.timestampToTime(self.dialogList.taskbegintime);
                self.dialogList.taskendtime = self.timestampToTime(self.dialogList.taskendtime);
                self.dialogList.reviewtime = self.timestampToTime(self.dialogList.reviewtime);
                api.updateAssignment(self.dialogList).then(res=>{
                    self.isDialog = false;
                    self.getTableList();
                })
            },
            getZzMaterieList(){/**获取总装任务物料列表 */
                let self = this;
                api.zzMaterieList(self.dialogList.tid).then(res=>{
                    self.zzMaterie.list=res.content;
                })
            },
            getZzSelectMaterielList(id){/**获取总装任务选择的物料列表 */
                 let self = this;
                api.zzSelectMaterial(id).then(res=>{
                    self.zzMaterie.selectList=res.content;
                })
            },
            getStoreMateriel(id){/**获取总装任务库存中物料列表 */
                let self = this;
                api.storeMaterialList(id).then(res=>{
                   self.zzMaterie.storeList=res.content;
                })
            },
            getZzPartsList(){/** 获取总装任务部件列表*/
                let self = this;
                api.zzPartsList(self.dialogList.tid).then(res=>{
                    self.zzParts.list=res.content;
                })
            },
            getZzSelectPartsList(id){/**获取总装任务选择的部件列表 */
                let self = this;
                api.zzSelectParts(id).then(res=>{
                    self.zzParts.selectList=res.content;
                })
            },
            getStoreParts(id){/** 获取总装任务库存中部件列表 */
            let self = this;
                api.storePartsList(id).then(res=>{
                    self.zzParts.storeList=res.content;
                })
            },
            getAssemblyList(){
                 let self = this;
                api.zzAssembly(self.dialogList.tid).then(res=>{
                    self.assembly.list=res.content;
                })
            },
            getResulteList(){
                let self = this;
                api.jqzzResultList(self.dialogList.tid).then(res=>{
                   self.result.list=res.content;
                })
            },
            showDialog1(type,row){
               let self = this;
               self.dialog1.isShow=true;
                switch(self.activeName){
                    case '1':
                        break;
                         case '2':
                            if(type=='materiel'){
                                self.dialog1.title="物料入库";
                                self.zzMaterie.dialogForm.pid=row.id;
                                self.getStoreMateriel(row.name);
                                self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);

                            }else{
                                self.dialog1.title="部件入库";
                                self.zzParts.dialogForm.pid=row.id;
                                self.zzParts.PartsName = row.name;
                                // self.getStoreParts(row.name);
                                self.getZzSelectPartsList(self.zzParts.dialogForm.pid);
                            }
                        break;
                         case '3':
                            self.dialog1.title=type=='add'?"添加装配过程":"修改装配过程";
                            self.assembly.dialogForm=type=='add'?{}:row;
                        break;
                         case '4':
                            self.dialog1.title=type=='add'?"添加输出结果":"修改输出结果";
                            self.result.dialogForm.list= row.jqzzResults;
                        break;
                        case '5':
                        case '7':
                            self.dialog1.title=row.fileName;
                            self.dialog1.content=row.initialContent;
                        break;
                        case '6':
                          self.dialog1.title=row.drawingName;
                            self.drawingPdf.src=`http://192.168.0.93:8889/adscm/zltx/jyDrawingList/viewDrawingPdf/${row.id}/1`;
                            self.drawingPdf.instructionsRotateApply=0;
                        break;
                }
            },
            showDialog2(type,row,name){
                let self = this;
                if(type=='add'){
                    self.dialog2.isShow=true;
                    if(name=='parts'){
                        self.dialog2.title="部件领取";
                        self.dialog2.table=self.zzParts.storeList;
                        self.dialog2.dialogForm={
                            pid:self.zzParts.dialogForm.pid,
                            code:'',
                            name:'',
                            list:[]
                        }
                    }else{
                        self.dialog2.title="物料领取";
                        self.dialog2.table=self.zzMaterie.storeList;
                        self.dialog2.dialogForm={
                            pid:self.zzMaterie.dialogForm.pid,
                            name:'',
                            num:1
                        }
                    }
                }else{
                    self.dialog2.isShow=true;
                    self.dialog2.checkForm.id=row.id;
                     if(name=='parts'){
                       self.dialog2.title="部件检验";
                       self.checkInfo();
                    }else{
                        self.dialog2.title="物料检验";
                        self.checkInfo();
                    }
                }
            },
            handleSizeChange(size){
               this.pagination.pageSize=size;
               this.pagination.currentPage=1;
               this.getTableList()
            },
            handleCurrentChange(current){
               this.pagination.currentPage=current;
               this.getTableList()
            },
            handleCurrentChange1(val){//选中的库存中的物料或部件
                let self =this;
                self.dialog2.dialogForm.name=val.tid;
            },
            addMateriel(){
                let self = this;
                let postData=null;
                if(self.dialog2.title=="部件领取"){
                    if(self.dialog2.dialogForm.name===''){
                        self.$message.error(`请输入部件条码`);
                        return;
                    }
                    postData={
                        pid:self.dialog2.dialogForm.pid,
                        name:self.dialog2.dialogForm.name,
                    }
                    api.zzInsertParts(postData).then(res=>{
                        self.dialog2.isShow=false;
                        self.getZzSelectPartsList(self.zzParts.dialogForm.pid);
                        self.getZzPartsList();
                        self.$message.success(`${self.dialog1.title}成功`)
                    })
                }else{
                     if(self.dialog2.dialogForm.name===''){
                        self.$message.error(`请选择一个物料`);
                        return;
                    }
                    postData={
                        pid:self.dialog2.dialogForm.pid,
                        name:self.dialog2.dialogForm.name,
                        num:self.dialog2.dialogForm.num
                    }
                    api.zzInsertMaterial(postData).then(res=>{
                        self.dialog2.isShow=false;
                        self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                        self.getZzMaterieList();
                        self.$message.success(`${self.dialog1.title}成功`)
                    })
                }
            },
            updateMaterialCheck(){
                let self = this;
                if(self.dialog2.title=="物料检验"){
                    api.updataCheckZzMaterial(self.dialog2.checkForm).then(res=>{
                    self.dialog2.isShow=false;
                    self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                    self.$message.success('检验记录提交成功!');
                },error=>{
                     self.$message.error('检验记录提交失败!');
                })
                }else{
                    api.updataCheckParts(self.dialog2.checkForm).then(res=>{
                    self.dialog2.isShow=false;
                    self.getZzSelectPartsList(self.zzParts.dialogForm.pid);
                    self.$message.success('检验记录提交成功!');
                },error=>{
                     self.$message.error('检验记录提交失败!');
                })
                }
            },
            assemblyUpdate(){/**装配过程检查录入 */
                 let self=this;
                if(self.assembly.disabled){
                    self.assembly.disabled=!self.assembly.disabled;
                }else{
                    self.assembly.submitLoading=true;
                    api.zzAssemblyUpdate(self.assembly.list).then(res=>{
                        self.assembly.submitLoading=false;
                        self.$message.success("装配过程检测信息录入成功！");
                        self.getAssemblyList();
                        self.assembly.disabled=!self.assembly.disabled;
                    },error=>{
                        self.assembly.submitLoading=false;
                        self.$message.error("装配过程检测信息录入失败！");
                    })
                }
            },
            deleteSelectMaterie(row,type){
            let self = this;
             self.$confirm('确认删除吗?', '提示', {
                    confirmButtonClass: 'el-button--warning'
                }).then(() => {
                    if(type=="parts"){
                        api.deleteZzParts(row.id).then(res=>{
                        self.getZzSelectPartsList(self.zzParts.dialogForm.pid);
                          self.$message.success('部件删除成功!')
                        },error=>{
                            self.$message.error('部件删除失败!')
                        })
                    }else{
                        api.deleteZzMaterial(row.id).then(res=>{
                           self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                            self.$message.success('物料删除成功!')
                        },error=>{
                            self.$message.error('物料删除失败!')
                        })
                    }

                })
            },
            checkInfo(){/**获取检验信息 */
                 let self= this;
                if(self.dialog2.title=="物料检验"){
                    api.checkZzMaterialInfo(self.dialog2.checkForm.id).then(res=>{
                       self.dialog2.checkForm.list =res.content;
                    })
                }else{
                    api.checkPartsInfo(self.dialog2.checkForm.id).then(res=>{
                        self.dialog2.checkForm.list =res.content;
                    })
                }
            },
            submitHanld(data){
                let self = this;
                switch(self.activeName){
                    case '2':
                    if(self.dialog2.title=="物料检验"){/**物料检验 */
                        api.updataCheckZzMaterial(data).then(res=>{
                            self.dialog2.isShow=false;
                            self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                            self.$message.success('检验记录提交成功!');
                        },error=>{
                            self.$message.error('检验记录提交失败!');
                        })
                    }else{/**部件检验 */
                        api.updataCheckParts(data).then(res=>{
                            self.dialog2.isShow=false;
                            self.getZzSelectPartsList(self.zzParts.dialogForm.pid);
                            self.$message.success('检验记录提交成功!');
                        },error=>{
                            self.$message.error('检验记录提交失败!');
                        })
                    }
                break;
                case '3':/**装配过程记录提交 */
                    let loading =self.$loading({
                        lock: true,
                        text: '数据提交中',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });
                    api.zzAssemblyUpdate(data).then(res=>{
                        loading.close();
                        self.$message.success("装配过程检测信息录入成功！");
                        self.getAssemblyList();
                        self.assembly.disabled=true;
                    },error=>{
                        loading.close();
                        self.$message.error("装配过程检测信息录入失败！");
                    })
                    break;
                case '4':
                api.addUpdateJqzzResult('update',data).then(res=>{
                    self.dialog1.isShow=false;
                    self.getResulteList();
                    self.$message.success(`${self.dialog1.title}成功`)
                },error=>{
                    self.$message.error(`${self.dialog1.title}失败`)
                })
                    break;
                }
            },
              addResult(){/**新增输出检查结果 */
                let self = this;
                  this.$confirm('是否确认新增输出结果?', '提示', {
                    confirmButtonClass: 'el-button--warning'
                }).then(() => {
                    api.addUpdateJqzzResult('insert',{pid:self.dialogList.tid}).then(res=>{
                    self.getResulteList();
                    self.$message.success(`新增输出结果成功`)
                },error=>{
                    self.$message.error(`新增输出结果失败`)
                })
                })

            },
            changeDisable(){
                let self = this;
                self.assembly.disabled=false;
            },
            printCode(code){/**打印条码 */
                LODOP = getLodop();
                LODOP.PRINT_INIT();
                LODOP.ADD_PRINT_BARCODE(25,15,150,80,"Code93",code);
                LODOP.PREVIEW();
            },
        searchAsyncSupplier(queryString, callback){
            let results = queryString ?  this.allZzProcedureList.filter(this.createStateFilter(queryString)) : this.allZzProcedureList;
            callback(results);
        },
        changeSupplier(item){
            this.search.nameId = item.id;
            this.search.name = item.value;
        },
        pickingAll(){
             /**一键领料 */
            let self = this;
            self.$confirm('是否一键领取所有物料和部件','提示',{
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(()=>{
                const loading = this.$loading({
                    lock: true,
                    text: 'Loading',
                    spinner: 'el-icon-loading',
                    background: 'rgba(0, 0, 0, 0.7)'
                });
                scybHttp.zzPickingAllMaterial(self.dialogList.tid).then(res=>{
                    self.$message.success('一键领取所有物料和部件成功');
                    self.getZzMaterieList();
                    self.getZzPartsList();
                    loading.close();
                },error=>{
                     loading.close();
                })
            }).catch(()=>{

            })
        },
        changStatus(row){
            let self = this;
            let title = row.state =='1'?'修改物料状态为不合格':'修改物料状态为合格'
            self.$confirm(title,'提示',{
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(()=>{
                const loading= this.$loading({
                        lock: true,
                        text: 'Loading',
                        spinner: 'el-icon-loading',
                        background: 'rgba(0, 0, 0, 0.7)'
                    });
                    row.state = row.state =='1'?'0':'1'
                scybHttp.zzChangeCheckStatus(row).then(res=>{
                    self.$message.success('修改物料状态成功');
                    self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                    loading.close();
                },error=>{
                    self.getZzSelectMaterielList(self.zzMaterie.dialogForm.pid);
                    loading.close();
                })
            }).catch(()=>{

            })
        },
        doLogin(e){
            let self = this;
            scybHttp.getInputParts(self.zzParts.PartsName,{code:self.dialog2.dialogForm.code}).then(res=>{
               self.dialog2.dialogForm.list=res.content;
               self.dialog2.dialogForm.name = res.content[0].tid;
            })

        }
    }
}
</script>
<style scoped>
.text-center{
    text-align: center;
}
#parts .el-table--small {
    font-size: 13px;
}

#parts .el-table .cell,
#parts .el-table th div {
    padding-left: 0;
    padding-right: 0;
}

#parts .el-tab-pane.dialog1 .el-form{
    margin-bottom: 30px;
}
#parts .formDemo{
    margin:24px auto;
}
#parts .formItem{
    font-size: 15px;
    padding:10px 0;
    margin-bottom: 18px;
    margin-right:10px;
    display:block;
}
#parts .formItem .formItemLabel{
    font-size: 15px;
    display: inline-block;
    text-align: right;
    margin-right:12px;
}
#parts .formItem  .reference{
    margin-left:24px;
    color:#999;
}
#parts .formItem .formInput{
    width:200px;
}
#parts  .formModle{
        width: 400px;
    }
#parts  .cameraItem{
    width:100%;

}
#parts  .cameraItem .cameraContent{
    width:200px;
        height:200px;
        line-height:200px;
        border:1px dashed #d9d9d9;
        text-align: center;
        border-radius: 4px;
}
#parts  .cameraItem .cameraContent:hover{
border:1px dashed #409eff;

}
</style>


